<div class="simple_div"><?= anchor('/user/messages/write/', _l('message_new') ) ?></div>
<div class="table">
	<h2><?= _l('statistic_title') ?></h2>
	
	<div class="table_body">
		<?= _l('message_count_all') ?>: <?= $total ?> | 
		<?= _l('message_count_new') ?>: <?= $new ?> | 
		<?= _l('message_count_total') ?>: <?= $send ?>
	</div>


	<h2><?= _l('personal_title') ?></h2>
	<table width="100%" cellspacing="0" cellpadding="2">
		<tr>
			<th><?= _l('message_subject') ?></th>
			<th><?= _l('message_author') ?></th>
			<th><?= _l('message_date') ?></th>
			<th><?= _l('message_options') ?></th>
		</tr>
		<?php foreach($messages as $message): ?>
		<tr>
			<colgroup class="ad_tr">
			<td>
				<a href="/user/messages/<?=$message['id']?>.html">
				<?php if ($message['status'] == 'new'): ?>
					<b><?=$message['subject']?></b>
				<?php else: ?>
					<?=$message['subject']?>
				<?php endif; ?>
				</a>
			</td>
			<td align="center"><?= url_user($message['from_id'], $message['from_name'])?></td>
			<td align="center"><?= $message['date'] ?></td>
			<td align="center">
				<a href='javascript:delete_("/user/messages/delete/<?=$message['id']?>.html");'><?= _l('message_delete') ?></a>
				<?php if ($message['friend']): ?>
					| 
					<a href="/user/messages/write/?to=<?=$message['from_id']?>&subject=<?=$message['subject']?>">
						<?= _l('message_reply') ?>
					</a>
				<?php endif;?>
			</td>
			</colgroup>
		</tr>
		<?php endforeach; ?>
	</table> 

<script>
	function delete_ (url_) 
	{
		if (window.confirm(<?= _l('message_confirm') ?>) == true) document.location.href = url_;
	}
</script>
